package com.jinyi.wwdeng.ui.permission

import android.Manifest
import com.jinyi.wwdeng.R

/**
 * JinYiTest
 * @Author wwdeng
 * @CreateTime: 2024/4/16 17:04
 * @Annotation：权限配置
 */
object PermissionConfig {

    /**
     * 根据权限类型匹配对应的图标
     */
    fun getPermissionIcon(permission: String): Int{
        var resId = R.mipmap.pic_kind_tips_icon
        when(permission){
            Manifest.permission.READ_SMS -> {
                resId = R.mipmap.pic_permission_sms_icon
            }
            Manifest.permission.READ_CALL_LOG -> {
                resId = R.mipmap.pic_permission_call_icon
            }
            Manifest.permission.READ_PHONE_STATE -> {
                resId = R.mipmap.pic_permission_phone_status_icon
            }
            Manifest.permission.READ_CONTACTS -> {
                resId = R.mipmap.pic_permission_contact_icon
            }
        }
        return resId
    }

    /**
     * 根据权限类型匹配对应的名称
     */
    fun getPermissionTitle(permission: String): Int{
        var titleId = 0
        when(permission){
            Manifest.permission.READ_SMS -> {
                titleId = R.string.permission_sms_data_collection
            }
            Manifest.permission.READ_CALL_LOG -> {
                titleId = R.string.permission_call_log_collection
            }
            Manifest.permission.READ_PHONE_STATE -> {
                titleId = R.string.permission_phone_status_data_collection
            }
            Manifest.permission.READ_CONTACTS -> {
                titleId = R.string.permission_contact_data_collection
            }
        }
        return titleId
    }

}